// 导入二次封装axios
import koi from "@/utils/axios.ts";

// 统一管理接口
enum API {
  LIST_PAGE = "/blog/blogCategory/listPage",
  GET_BY_ID = "/blog/blogCategory/getById",
  ADD = "/blog/blogCategory/add",
  UPDATE = "/blog/blogCategory/update",
  DELETE = "/blog/blogCategory/deleteById",
  BATCH_DELETE = "/blog/blogCategory/batchDelete",
  UPDATE_STATUS = "/blog/blogCategory/updateStatus",
  GET_SORTED = "/blog/blogCategory/getSorted",
  LIST_EL_SELECT = "/blog/blogCategory/listElSelect"
}

// 多条件分页查询
export const listPage = (params: any) => {
  return koi.get(API.LIST_PAGE, params);
};

// 根据ID进行查询
export const getById = (id: any) => {
  return koi.get(API.GET_BY_ID + "/" + id);
};

// 添加
export const add = (data: any) => {
  return koi.post(API.ADD, data);
};

// 根据ID进行修改
export const update = (data: any) => {
  return koi.post(API.UPDATE, data);
};

// 删除
export const deleteById = (id: any) => {
  return koi.post(API.DELETE + "/" + id);
};

// 批量删除
export const batchDelete = (ids: any) => {
  return koi.post(API.BATCH_DELETE, ids);
};

// 修改文章类别状态
export const updateStatus = (id: any, categoryStatus: any) => {
  return koi.post(API.UPDATE_STATUS + "/" + id + "/" + categoryStatus);
};

// 文章类别获取最新排序
export const getSorted = () => {
  return koi.get(API.GET_SORTED);
};

// 查询文章类别
export const listCategoryElSelect = () => {
  return koi.get(API.LIST_EL_SELECT);
};

